package com.lsfb.signln.Leave.AddLeave;

import android.content.Context;
import android.view.View;

import com.lsfb.signln.R;
import com.zgscwjm.lsfbbasetemplate.adapter.CommonRecycAdapter;
import com.zgscwjm.lsfbbasetemplate.adapter.ViewHolderRecyc;

import java.util.List;

/**
 * Created by Administrator on 2018/2/9 0009.
 */

public class LeaveTypeAdapter extends CommonRecycAdapter<String> {
    private Context mContext;

    private ItemClickListener listener;

    public interface ItemClickListener {
        void onClick(String model, int position);
    }

    public LeaveTypeAdapter(Context context, List<String> list, int layoutId, ItemClickListener listener) {
        super(context, list, layoutId);
        mContext = context;
        this.listener = listener;
    }

    @Override
    public void convert(final ViewHolderRecyc holder, final String model) {
        holder.setText(R.id.tv_reason, model);

        holder.setOnclick(R.id.item_reason, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (listener != null) {
                    listener.onClick(model, holder.getPosition());
                }
            }
        });
    }
}
